<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="/WEB-INF/common/common.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta charset="utf-8">
  <title>layui</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" href="<%=path %>/layui/css/layui.css">
  <link rel="stylesheet" href="<%=path %>/layui/css/lxq.css">
	<script type="text/javascript" src="<%=path %>/layui/jquery-3.3.1.min.js"></script>
    <script type="text/javascript" src="<%=path %>/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="<%=path %>/layui/util.js" charset="utf-8"></script>
</head>
<body>
<div class="lxq-body">
	<div class="layui-row lxq-address">
		位置：数据管理>详情
		<hr>
	</div>


	
	<div class="layui-row lxq-search" >

		<div class="data-search">
		  搜索ID：
		  <div class="layui-inline">
		    <input class="layui-input" name="id" id="search_id" autocomplete="off">
		  </div>
		  <button class="layui-btn" data-type="reload">搜索</button>
		</div>
	
	</div>

 	<div class="layui-row lxq-form">
 	
 		<table id="dataTable" lay-filter="main">
		${json }
  <tbody>
 	<s:iterator value="dataList" >
 		<tr>
 			<td>${id }</td>
 			<s:iterator value="datas" var="d">
 				<td>${d }</td>
 			</s:iterator>
 		</tr>
 	</s:iterator>
  </tbody>
</table>
 	
 	</div>

</div>              
          

 
<script>
layui.use(['table'], function(){
  var table = layui.table;
  
  table.init('main', { //转化静态表格
      //height: 'full-500'
	  toolbar: 'true'
    }); 
  
  
  
  table.on('edit(main)', function(obj){
	  	var id = ${form.id};
	  	$.post('<%=basePath %>/biz/Data_edit',{json:JSON.stringify(obj.data),id:id},function(){});
	  });
  
	  //监听工具条
	  table.on('tool(main)', function(obj){
	    var data = obj.data;
		if(obj.event === 'del'){
	      layer.confirm('真的删除行么', function(index){
	        obj.del();
	        $.post('<%=basePath %>/biz/Data_del',{"id":data.id},function(){});
	        layer.close(index);
	      });
	    } 
	  });
  
	  
  
  var $ = layui.$, active = {
		    reload: function(){
		      var searchId = $('#search_id');
		      table.reload("data_form",{
		    	  url:'<%=basePath %>/biz/Form_list'
		    	  ,where: {
		    		  id: searchId.val()
		    	  }
		          ,page: {
		            curr: 1 //重新从第 1 页开始
		          }
		      });
		      //执行重载
		    }
  
		  };
		  
		  $('.data-search .layui-btn').on('click', function(){
		    var type = $(this).data('type');
		    active[type] ? active[type].call(this) : '';
		  });

  
});
</script>



    <script type="text/html" id="barDemo">
	<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
	</script>

</body>
</html>